﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Example05.aspx.cs" Inherits="Chapter27.Example05" %>

<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>代码清单 27-5 在浏览历史中导航</title>
    <meta name="author" content="Adam Freeman" />
    <meta name="description" content="A simple example" />
</head>
<body>
    <p>
        <button id="back">Back</button>
        <button id="forward">Forward</button>
        <button id="go">Go</button>
    </p>
    <script>
        var buttons = document.getElementsByTagName("button");
        for (var i = 0; i < buttons.length; i++) {
            buttons[i].onclick = handleButtonPress;
        }
        function handleButtonPress(e) {
            if (e.target.id == "back") {
                window.history.back();
            } else if (e.target.id == "forward") {
                window.history.forward();
            } else if (e.target.id == "go") {
                window.history.go("http://www.apress.com");
            }
        }
    </script>
</body>
</html>
